<?php
/**
 * 品牌推广报告（SB）
 */
namespace App\Logic\Amazon\AdsApi\ReportService;

class SbCampaigns
{
    use DealReport;
    public static function parse($lines,$accountId,$countryCode): bool
    {
        return DealReport::parseReport($lines,$accountId,$countryCode,'ads_sb_campaigns');
    }

    /**
     * 创建品牌推广SB报告
     * 报告类型：广告活动C Campaign reports
     * 广告活动类型：品牌推广SB
     * reportTypeId：sbCampaigns
     * @param $config
     * @param $profileId
     * @param $countryCode
     * @param $params
     * @return mixed
     */
    public static function createReport($config,$profileId,$countryCode,$params): mixed
    {
        //所有字段均为必填项
        $configuration = [
            'adProduct' => 'SPONSORED_BRANDS',
            'groupBy' => ["campaign"],
            'columns' => [
                'date','campaignName','impressions','clicks','cost','sales','salesClicks','unitsSold','unitsSoldClicks'
            ],
            'reportTypeId' => 'sbCampaigns',
            'timeUnit' => 'DAILY',
            'format' => 'GZIP_JSON',
        ];
        return DealReport::createReport($config,$profileId,$countryCode,$params,$configuration);
    }
}
